JBoss Community Archive (Read Only)

JBoss AS 7.2

How do I migrate my application from WebSphere to AS 7

The purpose of this guide is to document the application changes that are needed to successfully run and deploy WebSphere applications on AS 7.

Feel free to add content in any way you prefer. You do not need to follow the template below. This is a work in progress.

Introduction

About this Guide

JBoss AS 7 is a fast, lightweight, powerful implementation of the Java Enterprise Edition 6 specification. The architecture is built on the Modular Service Container and enables services on-demand when your application requires them. IBM WebSphere applications that adhere to the Java EE 6 specification should require minimal changes to run on JBoss AS 7.

The purpose of this document is to guide you through the planning process and migration of fairly simple and standard Java EE 6 IBM WebSphere applications to JBoss AS 7. It will not cover migration of advanced features such as portal, rules engines, workflow systems, or ESB frameworks. Red Hat Consulting offers a wide variety of workshops, training, and service offerings designed to help customers migrate more complex applications.

In this document, the variable 'JBOSS_HOME' is used to denote the path of your JBoss installation. Replace this variable with the directory path of your JBoss installation.

Introduction to the JBoss AS 7 Server

JBoss AS 7 is a fast, secure, powerful middleware platform built upon open standards, and compliant with the Java Enterprise Edition 6 specification. It integrates JBoss Application Server 7 with high-availability clustering, powerful messaging, distributed caching, and other technologies to create a stable and scalable platform. JBoss AS 7 is a certified implementation of the Java Enterprise Edition 6 Full Profile and Web Profile specifications.

The new modular structure allows for services to be enabled only when required, significantly increasing start up speed. The Management Console and Management Command Line Interface remove the need to edit XML configuration files by hand, adding the ability to script and automate tasks. In addition, it includes APIs and development frameworks that can be used to develop secure, powerful, and scalable Java EE applications quickly.

For more information about JBoss AS 7, see Getting Started with JBoss Application Server 7 .

Java Enterprise Edition 6 Overview

Overview of Java EE 6 Profiles

Java Enterprise Edition 6 (EE 6) includes support for multiple profiles, or subsets of APIs. The only two profiles that the EE 6 specification defines are the Full Profile and the Web Profile.
EE 6 Full Profile includes all APIs and specifications included in the EE 6 specification. EE 6 Web Profile includes a subset of APIs which are useful to web developers.

JBoss AS 7 is a certified implementation of the Java Enterprise Edition 6 Full Profile and Web Profile specifications.

Java Enterprise Edition 6 Web Profile

The Web Profile is one of two profiles defined by the Java Enterprise Edition 6 specification. It is designed for web application development.

Java EE 6 Web Profile Requirements
  • Java Platform, Enterprise Edition 6

  • Java Web Technologies

    • Servlet 3.0 (JSR 315)

    • JSP 2.2 and Expression Language (EL) 1.2

    • JavaServer Faces (JSF) 2.0 (JSR 314)

    • Java Standard Tag Library (JSTL) for JSP 1.2

    • Debugging Support for Other Languages 1.0 (JSR 45)

  • Enterprise Application Technologies

    • Contexts and Dependency Injection (CDI) (JSR 299)

    • Dependency Injection for Java (JSR 330)

    • Enterprise JavaBeans 3.1 Lite (JSR 318)

    • Java Persistence API 2.0 (JSR 317)

    • Common Annotations for the Java Platform 1.1 (JSR 250)

    • Java Transaction API (JTA) 1.1 (JSR 907)

    • Bean Validation (JSR 303)

Java Enterprise Edition 6 Full Profile

The Java Enterprise Edition 6 (EE 6) specification defines a concept of profiles, and defines two of them as part of the specification. Besides the items supported in the Java Enterprise Edition 6 Web Profile, the Full Profile supports the following APIs. JBoss AS 7 supports the Full Profile.

Items Included in the EE 6 Full Profile
  • EJB 3.1 (not Lite) (JSR 318)

  • Java EE Connector Architecture 1.6 (JSR 322)

  • Java Message Service (JMS) API 1.1 (JSR 914)

  • JavaMail 1.4 (JSR 919)

  • Web Service Technologies

    • Jax-RS RESTful Web Services 1.1 (JSR 311)

    • Implementing Enterprise Web Services 1.3 (JSR 109)

    • JAX-WS Java API for XML-Based Web Services 2.2 (JSR 224)

    • Java Architecture for XML Binding (JAXB) 2.2 (JSR 222)

    • Web Services Metadata for the Java Platform (JSR 181)

    • Java APIs for XML-based RPC 1.1 (JSR 101)

    • Java APIs for XML Messaging 1.3 (JSR 67)

    • Java API for XML Registries (JAXR) 1.0 (JSR 93)

  • Management and Security Technologies

    • Java Authentication Service Provider Interface for Containers 1.0 (JSR 196)

    • Java Authentication Contract for Containers 1.3 (JSR 115)

    • Java EE Application Deployment 1.2 (JSR 88)

    • J2EE Management 1.1 (JSR 77)

JBoss AS 7 Architectural Overview

The following sections highlight some basic information about JBoss Enterprise Application Platform 6. For complete information on how to download, install, configure, and develop applications, refer to the Installation Guide, Administration and Configuration Guide, and Development Guide located on the Customer Portal .

Review What's New and Different in JBoss AS 7

The following is a list of notable differences in JBoss AS 7 from the previous release.

Module based class loading

In previous releases of JBoss AS, the class loading architecture was hierarchical. In JBoss AS 7, class loading is based on JBoss Modules. This offers true application isolation, hides server implementation classes, and only loads the classes your application needs. Class loading is concurrent for better performance. Applications written for JBoss Enterprise Application Platform 5 must be modified to specify module dependencies and in some cases, repackage archives. For more information, refer to Class Loading and Modules in the Development Guide for JBoss Enterprise Application Platform 6 on the Customer Portal .

Domain Management

In JBoss AS 7, the server can be run as a standalone server or in a managed domain. In a managed domain, you can configure entire groups of servers at once, keeping configurations synchronized across your entire network of servers. While this should not impact applications built for previous releases, this can simplify management of deployments to multiple servers. For more information, refer to About Managed Domains in the Administration and Configuration Guide for JBoss Enterprise Application Platform 6 on the Customer Portal .

Domain mode is not supported in the following JBoss Enterprise products:

  • JBoss Portal Platform 6

Deployment Configuration
Standalone Servers and Managed Domains

In JBoss Enterprise Application Platform 6, deployment configuration is done using one file. This file is used to configure all the services and subsystems used for the deployment.

  • A standalone server is configured using the JBOSS_HOME/standalone/configuration/standalone.xml file.

  • For servers running in a managed domain, the server is configured using the JBOSS_HOME/domain/configuration/domain.xml file.

Ordering of deployments

JBoss AS 7 uses fast, concurrent initialization for deployment resulting in improved performance and efficiency. In most cases, the application server is able to automatically determine dependencies in advance and choose the most efficient deployment strategy. However, JBoss Enterprise Application Platform 5 applications that consist of multiple modules deployed as EARs and use legacy JNDI lookups instead of CDI injection or resource-ref entries may require configuration changes.

Archive Packaging and Assembly

The following are general rules for assembly of archives or directories that will be deployed to JBoss AS 7:

  • Archives may be nested within other archived deployments.

  • Extracted directories may be nested in extracted deployments.

  • Archives may be nested in extracted deployments.

  • Extracted directories may NOT be nested in archived deployments. You must recreate archives for the nested artifacts.

  • In WebSphere, an extracted WAR, EAR, or other archive can be deployed without the archive extension in the directory name. In JBoss, the extension must appear on the extracted directory name, for example myEnterpriseApp.ear or myWebApp.war.Extracted WAR, EAR, or other archive directories must contain archive extension on the folder name, for example myEnterpriseApp.ear or myWebApp.war.

  • For web applications, it is generally better to avoid the use of a web.xml file if possible. If this file is required, it should be located under the root of the application WEB-INF/ directory.

  • If your enterprise applications requires an application.xml file, it should be located under the META-INF/ directory in the root of the EAR.

Directory Structure and Scripts

Configuration files can be found in the following locations:

  • For standalone servers are now located in the JBOSS_HOME/standalone/configuration/ directory and deployments are located in the JBOSS_HOME/standalone/deployments/ directory.

  • For servers running in a managed domain, configuration files can be found in the JBOSS_HOME/domain/configuration/ directory and deployments can be found in the JBOSS_HOME/domain/deployments/ directory.

In JBoss Enterprise Application Platform 6, the server start script is dependent on how you run your server.

  • The Linux script JBOSS_HOME/bin/standalone.sh or Windows script JBOSS_HOME/bin/standalone.bat is used to start a standalone server.

  • The Linux script JBOSS_HOME/bin/domain.sh or Windows script JBOSS_HOME/bin/domain.bat is used to start a managed domain.

JNDI Lookups

JBoss AS 7 now uses standardized portable JNDI namespaces. Applications that use other types of JNDI lookups must be changed to follow the new standardized JNDI namespace convention. For more information about JNDI naming syntax, see the section below on “Portable JNDI Naming Syntax”.

Modules and Modular Class Loading

Class loading in AS 7 is based on the JBoss Modules project.

Modules

A Module is a logical grouping of classes used for class loading and dependency management. JBoss AS 7 identifies two different types of modules, sometimes called static and dynamic modules. However the only difference between the two is how they are packaged. All modules provide the same features.

Static Modules

Static Modules are predefined in the JBOSS_HOME/modules/ directory of the application server. Each sub-directory represents one module and contains one or more JAR files and a configuration file (module.xml). The name of the module is defined in the module.xml file. All the application server provided APIs are provided as static modules, including the Java EE APIs as well as other APIs such as JBoss Logging. The following is an example module.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
  <resources>
    <resource-root path="mysql-connector-java-5.1.15.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

The module name, com.mysql, should match the directory structure for the module.

Creating custom static modules can be useful if many applications are deployed on the same server that use the same third party libraries. Instead of bundling those libraries with each application, a module containing these libraries can be created and installed by the JBoss administrator. The applications can then declare an explicit dependency on the custom static modules.

Dynamic Modules

Dynamic Modules are created and loaded by the application server for each JAR or WAR deployment, or subdeployment in an EAR. The name of a dynamic module is derived from the name of the deployed archive. Because deployments are loaded as modules, they can configure dependencies and be used as dependencies by other deployments.

Modules are only loaded when required. This usually only occurs when an application is deployed that has explicit or implicit dependencies.

For more information on modular class loading, see Class Loading in AS7 .

Modules and Class Loading in Enterprise Archives

Enterprise Archives (EAR) are not loaded as a single module like JAR or WAR deployments. They are loaded as multiple unique modules.

The following rules determine what modules exist in an EAR.

  • Each WAR and EJB JAR subdeployment is a module.

  • The contents of the lib/ directory in the root of the EAR archive is a module. This is called the parent module.

These modules have the same behavior as any other module with the following additional implicit dependencies:

  • WAR subdeployments have implicit dependencies on the parent module and any EJB JAR subdeployments.

  • EJB JAR subdeployments have implicit dependencies on the parent module and any other EJB JAR subdeployments.

    No subdeployment ever gains an implicit dependency on a WAR subdeployment. Any subdeployment can be configured with explicit dependencies on another subdeployment as would be done for any other module.

The implicit dependencies described above occur because JBoss AS 7 has subdeployment class loader isolation disabled by default.

Subdeployment class loader isolation can be enabled if strict compatibility is required. This can be enabled for a single EAR deployment or for all EAR deployments. The Java EE 6 specification recommends that portable applications should not rely on subdeployments being able to access each other unless dependencies are explicitly declared as Class-Path entries in the MANIFEST.MF file of each subdeployment.

Directory Structure of JBoss AS 7

JBoss AS 7 includes a simplified directory structure, compared to previous versions. The following table contains a listing of the directories and a description of what each directory contains. It also includes directory structures of the standalone/ and domain/ folders.

level Directories

Name

Purpose

appclient/

Contains configuration details for the application client container.

bin/

Contains start-up scripts for JBoss AS 7 on Red Hat Enterprise Linux and Microsoft Windows.

bundles/

Contains OSGi bundles which pertain to JBoss AS 7 internal functionality.

docs/

License files, schemas, and examples.

domain/

Configuration files, deployment content, and writable areas used when JBoss AS 7 runs as a managed domain.

modules/

Modules which are dynamically loaded by JBoss AS 7 when services request them.

standalone/

Configuration files, deployment content, and writable areas used when JBossAS 7 runs as a standalone server.

welcome-content/

Contains content used by the Welcome web application which is available on port 8080 of a default installation.

jboss-modules.jar

The bootstrapping mechanism which loads modules.

Directories within the domain/ directory

Name

Purpose

configuration/

Configuration files for the managed domain. These files are modified by the Management Console and Management CLI, and are not meant to be edited directly.

data/

Information about deployed services. Services are deployed using the Management Console and Management CLI, rather than by a deployment scanner. Therefore, do not place files in this directory manually.

log/

Contains the run-time log files for the host and process controllers which run on the local instance.

servers/ Contains the equivalent data/, log/, and tmp/ directories for each server instance in a domain, which contain similar data to the same directories within the top-level domain/ directory. |

tmp/

Contains temporary data such as files pertaining to the shared-key mechanism used by the Management CLI to authenticate local users to the managed domain.

Directories within the standalone/ directory

Name

Purpose

configuration/

Configuration files for the standalone server. These files are modified by the Management Console and Management CLI, and are not meant to be edited directly.

deployments/

Information about deployed services. The standalone server does include a deployment scanner, so you can place archives in this directory to be deployed. However, the recommended approach is to manage deployments using the Management Console or Management CLI.

lib/

External libraries which pertain to a standalone server mode. Empty by default.

tmp/

Contains temporary data such as files pertaining to the shared-key mechanism used by the Management CLI to authenticate local users to the server.

Administration Tools

Management Console

The Management Console is a web-based administration tool used to to start and stop servers, deploy and undeploy applications, tune system settings, and make persistent modifications to the server configuration. The Management Console also has the ability to perform administrative tasks, with live notifications when any changes require the server instance to be restarted or reloaded. In a Managed Domain, server instances and server groups in the same domain can be centrally managed from the Management Console of the domain controller.

JBoss CLI

The Management Command Line Interface (CLI) is a command line administration tool that can perform operations in batch modes, allowing multiple tasks to be run as a group.

JON

TODO: section is not complete.

Prepare for Migration

Before you attempt to migrate your WebSphere application to JBoss AS 7, it helps to have an understanding of the process.

Become Familiar with Java EE 6

JBoss AS 7 is a fast, lightweight, powerful implementation of the Java Enterprise Edition 6 specification, so understanding Java EE 6 is a great place to start. You can find Java Enterprise Edition 6 documentation here: http://www.oracle.com/technetwork/java/javaee/tech/index.html and a Java EE 6 tutorial here: http://docs.oracle.com/javaee/6/tutorial/doc/.

Become Familiar with JBoss AS 7

See the Admin Guide and Developer Guide for details on how to configure and develop applications with JBoss AS 7.

Identify the current hardware and operating systems

This includes the operating systems and versions, number of processors, memory capacity, disk usage and capacity.

Examine the existing WebSphere application server and platform

Examine the existing application server and platform, including the operating systems, JVMs, databases, and web servers, and determine the equivalent capabilities in JBoss AS 7. The supported JBoss configurations can be found on the Customer Portal at https://access.redhat.com/support/configurations/jboss/.

Examine and understand the existing WebSphere application

Thoroughly examine the existing WebSphere application. Be totally familiar with its architecture, functions, features and components. In particular, note the proprietary APIs and features and determine the JBoss or Java EE 6 equivalents.

Review monitoring and administration procedures and tools

Perform a review of all monitoring and administration procedures and tools in place to identify any that may need modification or replacement to work with the JBoss AS 7.

Review resources available for the migration process

Resources include people, software, and hardware. Assess the skills of the development team that will be doing the work and plan for training or additional consulting help. Also be aware that additional hardware and other resources will be required during the migration process until the effort is completed.

Prepare a migration plan

Develop a migration plan including a detailed roadmap and resources that will be needed.

Migrate the Application

Overview of the Server Configuration and Deployment Descriptor Files

JBoss AS 7 Configuration File

In JBoss AS 7, the server can be run as a standalone server or in a managed domain. A standalone server is configured using the JBOSS_HOME/standalone/configuration/standalone.xml file. For servers running in a managed domain, the server is configured using the JBOSS_HOME/domain/configuration/domain.xml and JBOSS_HOME/domain/configuration/host.xml files.

In most cases you will not edit these files directly. You can use the Management Console or Management Command Line Interface (CLI) to configure the server and the changes will be reflected in the server configuration file. You can find more information about the Management CLI here: CLI Recipes.

WebSphere Server Configuration and Deployment Descriptor Files

IBM WebSphere uses an extensions XMI file to configure and extend appliation functionality. This file is named ibm-web-ext.xmi and is located in each web module WEB-INF directory.

Migrate the Server Configuration

Unfortunately, server configuration is a complex process and there is not an easy mapping from one application server to another. The best approach is to open the WebSphere configuration files and examine each section. Use the Admin Guide to find information about how to perform the same configuration in JBoss.

Map Configuration Files and Descriptors to the JBoss Equivalent

WebSphere Web Application Server Extensions

WebSphere Application Server provides proprietary features and configurations within a series of .xmi files. The web application extensions are specified in the ibm-web-ext.xmi file.The following section describes how to map the most common configurations settings to JBoss.

autoresponseEncoding and autorequestEncoding

In WebSphere, the Web container does not automatically set request and response encodings and response content types. If a programmer needs to change the encoding value from the Servlet 2.3 default of "ISO-8859-1", the autoResponseEndcoding and autoRequestEncoding extensions are set to true to enable the server to set the encoding value and content type.

These values are specified in the ibm-web-ext.xmi file as:
autoResponseEncoding="true"
autoRequestEncoding="true"

In JBoss, you can you can override the character encoding used to decode the URI bytes in one of the following ways:

  1. You can set the encoding at a server level by running the following in the Management CLI:

    /system-property=org.apache.catalina.connector.URI_ENCODING:add(value=UTF-8)
    /system-property=org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING:add(value=true)
  2. You can use the javax.servlet.Filter class to enforce character encoding for specific request and response content:

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
      response.setContentType("text/html; charset=UTF-8");
      request.setCharacterEncoding("UTF-8");
      response.setCharacterEncoding("UTF-8");
      chain.doFilter(request, response);
    }
reloadingEnabled and reloadInterval

WebSphere uses these properties to enable automatic reloading of web applications when application files have changed.

In JBoss AS 7, automatic reloading is configured in the 'deployment-scanner' subsystem of the server configuration file. You can enable automatic deployment of exploded archives and set the timer interval to check for updated files. You can also configure the server to monitor deployments to external directories. For more information, see the section 'Deploy with the Deployment Scanner' in the 'Administration and Configuration Guide' located on the Customer Portal.

You can use the JBoss Management CLI to modify the deployment-scanner configuration settings. The following examples show how modify and view the current deployment-scanner settings.

  1. Enable the automatic deployment of an exploded archive and specify the scanner interval time in milliseconds to check for file updates

    1. Connect to JBoss server using the Management CLI
      Open a terminal and type the following to connect to the JBoss server.
      For Linux, enter the following at the command line:

      $ JBOSS_HOME/bin/jboss-cli.sh --connect

      For Windows, enter the following at a command line:

      C:\>JBOSS_HOME\bin\jboss-cli.bat --connect

      You should see the following response:

      Connected to standalone controller at localhost:9999
    2. Navigate to the default scanner in the 'deployment-scanner' subsystem:

      cd subsystem=deployment-scanner/scanner=default
    3. Type the following command to set the 'auto-deploy-exploded' attrbute to 'true'.

      :write-attribute(name=auto-deploy-exploded,value=true)

      You should see the following response:

      {
          "outcome" => "success",
      }
    4. Specify the scanner interval in milliseconds between checks for file updates.

      :write-attribute(name=scan-interval,value=10000)

      You should see the following response:

      {
          "outcome" => "success",
      }
  2. To track a specific external folder for updates, issue the following command:

    :write-attribute(name=path,value=home/username/external-deployments)

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }
  3. To view the current setting in the Managment CLI, type:

    :read-resource

    You should see:

    {
        "outcome" => "success",
        "result" => {
            "auto-deploy-exploded" => true,
            "auto-deploy-xml" => true,
            "auto-deploy-zipped" => true,
            "deployment-timeout" => 60,
            "path" => "home/username/external-deployments",
            "relative-to" => "jboss.server.base.dir",
            "scan-enabled" => true,
            "scan-interval" => 10000
        }
    }
  4. After you run the above commands, the 'deployment-scanner' subsystem in the server configuration file now contains the new attribute value.

    <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
        <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="10000" auto-deploy-exploded="true"/>
    </subsystem>

For information on how to configure the server to monitor updates to JSP files, see the section on jspAttributes below.

autoLoadFilters

This WebSphere setting specifies whether filters should be loaded on the startup of a web module. JBoss AS 7 automatically loads filters on startup so there is no equivalent configuration.

mimeFilters

WebSphere provides MIME filters that can direct requests to URIs within the web application based on the content type of the request. To provide similar functionality in JBoss AS 7, you write a custom servlet filter, then specify it in the standard web.xml file.

fileServingAttributes

The WebSphere file serving attribute properties define the behavior of how the web container serves files. These properties include the buffer size used by the web container for file serving. There are no equivalent settings for input and output buffer sizing in JBoss AS 7.

directoryBrowsingEnabled

This WebSphere attribute allows directory browsing from within the application. For security reasons, this feature is disabled by default in JBoss EAP 6. It can be reenabled by adjusting the configuration of the web subsystem as follows.

To modify the setting for a Standalone server using the JBoss Management CLI, type the following:

/subsystem=web/configuration=static-resources/:write-attribute(name=listings,value=true)

To modify the setting for a managed domain using the JBoss Management CLI, type the following::
You should see the following response:

/profile=full/subsystem=web/configuration=static-resources/:write-attribute(name=listings,value=true)
serveServletsByClassnameEnabled

This WebSphere attribute allows servlets to be served by fully-qualified classname. There is no equivalent setting in JBoss AS 7.

jspAttributes

Websphere uses this setting to configure JSP attributes.

In JBoss AS 7, the following JSP attributes are configured in the <jsp-configuration> element of the 'web' subsystem in the server configuration file.

Attribute Name

Description

Default

check-interval

Check interval for JSP updates using a background thread.

0

development

Enable the development mode, which gives more information when an error occurs.

false

disabled

Enable the JSP container.

false

display-source-fragment

When a runtime error occurs, attempts to display corresponding JSP source fragment.

true

dump-smap

Write SMAP data to a file.

false

error-on-use-bean-invalid-class-attribute

Enable errors when using a bad class in useBean.

false

generate-strings-as-char-arrays

Generate String constants as char arrays.

false

java-encoding

Specify the encoding used for Java sources.

UTF8

keep-generated

Keep the generated Servlets.

true

mapped-file

Map to the JSP source.

true

modification-test-interval

Minimum amount of time between two tests for updates, in seconds.

4

recompile-on-fail

Retry failed JSP compilations on each request.

false

scratch-dir

Specify a different work directory.

N/A

smap

Enable SMAP.

true

source-vm

Source VM level for compilation.

1.5

tag-pooling

Enable tag pooling.

true

target-vm

Target VM level for compilation.

1.5

trim-spaces

Trim some spaces from the generated Servlet.

false

x-powered-by

Enable advertising the JSP engine in x-powered-by.

true

The following example shows how to use the JBoss Management CLI to set or change a JSP attribute.

  1. Connect to JBoss server using the Management CLI
    Open a terminal and type the following to connect to the JBoss server.
    For Linux, enter the following at the command line:

    $ JBOSS_HOME/bin/jboss-cli.sh --connect

    For Windows, enter the following at a command line:

    C:\>JBOSS_HOME\bin\jboss-cli.bat --connect

    You should see the following response:

    Connected to standalone controller at localhost:9999
  2. Enable development mode

    /subsystem=web/configuration=jsp-configuration:write-attribute(name=development,value=true)

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }
  3. Set the scan interval to detect JSP file changes:

    /subsystem=web/configuration=jsp-configuration/:write-attribute(name=check-interval,value=30)

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {
            "operation-requires-reload" => true,
            "process-state" => "reload-required"
        }
    }
  4. Reload the server configuration

    :reload

    You should see the following response:

    {
        "outcome" => "success",
        "response-headers" => {"process-state" => "reload-required"}
    }
  5. To view the current settings in the Management CLI, navigate to the 'web' subsystem 'jsp-configuration'

    cd subsystem=web/configuration=jsp-configuration

    Then type the following command:

    :read-resource

    You should see the following response:

    {
        "outcome" => "success",
        "result" => {
            "check-interval" => 30,
            "development" => true,
            "disabled" => false,
            "display-source-fragment" => true,
            "dump-smap" => false,
            "error-on-use-bean-invalid-class-attribute" => false,
            "generate-strings-as-char-arrays" => false,
            "java-encoding" => "UTF8",
            "keep-generated" => true,
            "mapped-file" => true,
            "modification-test-interval" => 4,
            "recompile-on-fail" => false,
            "scratch-dir" => undefined,
            "smap" => true,
            "source-vm" => "1.5",
            "tag-pooling" => true,
            "target-vm" => "1.5",
            "trim-spaces" => false,
            "x-powered-by" => true
        }
    }
  6. The 'web' subsystem in the server configuration file now contains the new attribute value.

    <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
        <configuration>
            <jsp-configuration development="true" check-interval="30"/>
        </configuration>
        <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
        <virtual-server name="default-host" enable-welcome-root="true">
            <alias name="localhost"/>
            <alias name="example.com"/>
        </virtual-server>
    </subsystem>
defaultErrorPage

This WebSphere attribute specifies the URI of a page or servlet to use as the default error page for the web application.

JBoss AS 7 supports the standard Java Servlet 3.0 specification, so you simply define the <error-page> in the web.xml file as follows:

<error-page>
   <location>/general-error.html</location>
</error-page>
servletCacheConfigs

WebSphere provides configuration for caching the output of servlets and JSP pages to its dynamic cache. To provide similar functionality in JBoss AS 7 you use simple ServletFilter and caching provider, such as Infinispan.

additionalClasspath

This property allows users to specify an additional classpath to reference resources outside the WEB-INF/ directory.

JBoss AS 7 uses a modular class loading system. You can use the jboss-deployment-structure.xml file or define a custom module to load class dependencies that are external to the deployment. For more information, see Create or modify files that control class loading in AS7

Web Application Descriptor Files
web.xml

The web.xml file, located in the WEB-INF/ directory, is the standard Java EE deployment descriptor for a web application. This file is often no longer required since the Servlet 3.0 specification was released. If it is defined, it must not contain specific vendor information since it must be portable across different application servers.

References to JDBC, Mail and JMS resources can be defined in the web.xml file. However, the mapping of the resource name to the JNDI binding defined in JBoss is configured in the jboss-web.xml file. This is done using a <resource-ref> element in the jboss-web.xml deployment descriptor. For example, to reference the 'DefaultDS' datasource defined in the jboss-web.xml configuration, you use add the following code to the web.xml file:

<resource-ref>
    <description>The default DS</description>
    <res-ref-name>jdbc/DefaultDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>
jboss-web.xml

The jboss-web.xml configuration file, located in the WEB-INF/ directory, contains JBoss specific JNDI mapping information. This configuration file can be used in conjunction with the web.xml file to map JBoss specific services to their JNDI names in the JBoss environment. The <resource-ref> element in the jboss-web.xml file maps to the <resource-ref> element defined in the web.xml file.

The following code in the jboss-web.xml file maps the JDBC datasource to the web.xml file example:

<resource-ref>
    <res-ref-name>jdbc/DefaultDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <jndi-name>java:global/DefaultDS</jndi-name>
</resource-ref>
jboss-deployment-structure.xml

This file is a JBoss specific deployment descriptor that can provide fine grained control over class loading in a deployment. This file can be used to add explicit dependencies, prevent automatic loading of implicit dependencies, define additional modules from the resources of that deployment, change the subdeployment isolated class loading behavior in an EAR's deployment, and add additional resource roots to a module in an EAR.

The following is an example of a jboss-deployment-structure.xml file that adds a dependency for JSF 1.2 module and prevents the automatic loading of the JSF 2.0 module.

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
    <deployment>
        <dependencies>
            <module name="javax.faces.api" slot="1.2" export="true"/>
                <module name="com.sun.jsf-impl" slot="1.2" export="true"/>
        </dependencies>
    </deployment>
    <sub-deployment name="jboss-seam-booking.war">
        <exclusions>
            <module name="javax.faces.api" slot="main"/>
                <module name="com.sun.jsf-impl" slot="main"/>
        </exclusions>
        <dependencies>
            <module name="javax.faces.api" slot="1.2"/>
            <module name="com.sun.jsf-impl" slot="1.2"/>
        </dependencies>
    </sub-deployment>
</jboss-deployment-structure>
Other WebSphere Configuration Files
server.xml

ToDo: this section needs content

WebSphere Proprietary Libraries and APIs

An issue that commonly must be resolved is dependencies on proprietary vendor libraries in the application server. For example, an application could have dependencies on IBM’s implementation of Date or StringTokenizer. Where possible, replace proprietary code with the equivalent standard Java EE class. If this is not possible, you must create a new implementation using the standard Java EE API or another Java EE compliant open source API. Windup is an excellent tool to help you analyze the code and locate proprietary code.

WebSphere Proprietary Features

HttpSession Sharing Between WAR modules

WebSphere provides a proprietary extension to the Servlet API that allows you to share session context between WAR modules across an enterprise application.

This is not an official standard and is not supported in JBoss Enterprise Application Platform.

Migrate WebSphere JPA Persistence Providers

IBM WebSphere Application Server V8.5.5 provides two persistence providers in the product. One is the Apache OpenJPA persistence provider, which is based on the Apache OpenJPA 2.x open source project. WebSphere also provides the JPA for WebSphere Application Server persistence provider. This is the default provider and adds extensions to Apache OpenJPA to provide additional features, functionality, and tools for WebSphere application development and deployment.

The default JPA persistence provider for JBoss Enterprise Application Platform is Hibernate EntityManager. However, you can configure a JBoss module for the Apache OpenJPA persistence provider. WebSphere applications that use JPA for WebSphere Application Server will require code changes for the IBM specific extensions. This topic discusses the migration options.

Migrate Applications using Apache OpenJPA

Applications that use Apache OpenJPA should require minimal changes to run on JBoss EAP. You must define a module for Apache OpenJPA and tell JBoss EAP to use it.

  1. Create a directory structure under the EAP_HOME/module/system/layers/base/org/apache/ directory to contain the OpenJPA JARs and the module.xml file. For example:

    $ cd EAP_HOME/modules/system/layers/base/org/apache/
    $ mkdir -p openjpa/main/
  2. Copy the following JARs to the EAP_HOME/modules/system/layers/base/org/apache/openjpa/main/ directory.

    • openjpa-2.1.0.jar

    • serp-1.13.1.jar

  3. Create a module.xml file in the EAP_HOME/modules/system/layers/base/org/apache/openjpa/main/ directory directory containing the following XML:

    <module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa">
        <resources>
            <resource-root path="openjpa-2.1.0.jar"/>
            <resource-root path="serp-1.13.1.jar"/>
            <!-- Insert resources here -->
        </resources>
        <dependencies>
            <module name="javax.persistence.api"/>
            <module name="javax.transaction.api"/>
            <module name="javax.validation.api"/>
            <module name="org.apache.commons.lang"/>
            <module name="org.apache.commons.collections"/>
            <module name="org.apache.log4j"/>
        </dependencies>
    </module>
  4. The "jboss.as.jpa.providerModule" property in the persistence.xml file specifies the name of the JPA persistence provider module. Add the following property to the persistence.xml file:

    <property name="jboss.as.jpa.providerModule" value="openjpa" />

Migrate Applications using JPA for WebSphere Application Server

Although JPA for WebSphere Application Server is built upon the Apache OpenJPA open source project, it contains extensions that are specific to WebSphere. For this reason, you can not package this provider as a module in JBoss EAP. You must remove or replace any code that uses the extensions and configure the application to use the Apache OpenJPA persistence provider.

  1. Remove or replace any code that uses the JPA for WebSphere Application Server extensions. Examples of these extensions include:

    • Static SQL support using the DB2® pureQuery feature

    • Access intent support

    • Enhanced tracing support

    • Version ID generation

    • WebSphere product-specific commands and scripts

    • Translated message files

    • Check in-memory caches for lazily loaded many-to-one or one-to-one relationships.

  2. Some of the default configuration property values for the JPA for WebSphere Application Server persistence provider are different than the Apache OpenJPA provider. The following are examples of properties that have different default values.

    • openjpa.Compatibility - Apache OpenJPA defaults to "StrictIdentityValues=false". JPA for WebSphere Application Server defaults to "StrictIdentityValues=true".

    • openjpa.RuntimeUnenhancedClasses - Apache OpenJPA defaults to "unsupported". JPA for WebSphere Application Server defaults to "warn".

    • openjpa.DynamicEnhancementAgent - Apache OpenJPA defaults to "true". JPA for WebSphere Application Server defaults to "false".

    • openjpa.DriverDataSource - Apache OpenJPA defaults to "auto". JPA for WebSphere Application Server defaults to "simple".

  3. Search for use of the following JPA for WebSphere Application Server classes. These classes override the corresponding Apache OpenJPA classes. You must modify the code to use the Apache OpenJPA classes.

    • com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager;

    • com.ibm.ws.persistence.jdbc.kernel.ConstraintUpdateManager;

    • com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCBrokerFactory;

    • com.ibm.ws.persistence.jdbc.sql.DB2Dictionary;

    • com.ibm.ws.persistence.jdbc.sql.OracleDictionary;

    • com.ibm.ws.persistence.jdbc.sql.SQLFactoryImpl;

    • com.ibm.ws.persistence.jdbc.sql.SQLServerDictionary;

    • com.ibm.ws.persistence.kernel.WsJpaBrokerImpl;

    • com.ibm.ws.persistence.kernel.WsJpaFinalizingBrokerImpl;

  4. When you are sure your application uses only the Apache OpenJPA API, follow the instructions above to Migrate Applications using Apache OpenJPA.

Modify the Application Code to Use the Hibernate JPA API

Another option is to rewrite the application code to use Hibernate JPA. For more information about the JBoss EAP Hibernate JPA implementation, see Java Persistence API (JPA) in the Development Guide for JBoss Enterprise Application Platform.

WebSEAL Integration

ToDo: Need to add content here.

Other Changes

WebSphere JMX Lookups versus JBoss JMX Lookups

ToDo: this section needs content

WebSphere JNDI Lookups versus JBoss JNDI Looups

ToDo: this section needs content

WebSphere Specific IBM Datasources

ToDo: this section needs content

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 13:28:11 UTC, last content change 2014-02-08 13:20:02 UTC.